# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>

_pyname=OWSLib
_realname=owslib
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=0.32.1
pkgrel=1
pkgdesc="Python package for client programming with Open Geospatial Consortium (OGC) web service interface standards, and their related content models (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: python-owslib'
  'purl: pkg:pypi/owslib'
)
license=('spdx:BSD-3-Clause')
url="https://owslib.readthedocs.io/"
msys2_repository_url='https://github.com/geopython/OWSLib/'
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-dateutil"
         "${MINGW_PACKAGE_PREFIX}-python-lxml"
         "${MINGW_PACKAGE_PREFIX}-python-pytz"
         "${MINGW_PACKAGE_PREFIX}-python-requests"
         "${MINGW_PACKAGE_PREFIX}-python-yaml")
source=("https://pypi.org/packages/source/${_pyname::1}/${_pyname}/${_pyname/-/_}-${pkgver}.tar.gz")
sha256sums=('339d499849a14b9c27eeebb67fbcfa52c2e7be82251750dab8b5721669cd1f04')

build() {
  cp -r "${_pyname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE -t "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}"
}
